package com.hdax.easybuy.controller;

import com.hdax.easybuy.api.ProductCategoryServiceClient;
import com.hdax.easybuy.entity.ProductCategory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
//@RequestMapping("/managerProductCategory")
public class ProductCategoryManagerController {
    @Resource
    private ProductCategoryServiceClient productCategoryServiceClient;

    @RequestMapping("/managerProduct/queryCategoryAll")
    //@ResponseBody
    public List<ProductCategory> queryCategoryAll(){
        return productCategoryServiceClient.queryCategoryAll();
    }
    //根据父id查询所有的类别
    @RequestMapping("/managerProduct/queryByParentId/{id}")
    public List<ProductCategory> queryByParentId(@PathVariable("id") int id){
        return productCategoryServiceClient.queryAllProductCategory(id);
    }



}
